const fs = require("fs");
const path = require("path");

const envFiles = [".env.development", ".env.production"];
const distDir = path.resolve(__dirname, "../build");

if (!fs.existsSync(distDir)) {
    fs.mkdirSync(distDir, { recursive: true });
}

envFiles.forEach(file => {
    const src = path.resolve(__dirname, "../", file);
    const dest = path.resolve(distDir, file);

    if (fs.existsSync(src)) {
        fs.copyFileSync(src, dest);
        console.log(`Copied ${file} to ${distDir}`);
    } else {
        console.warn(`File not found: ${file}`);
    }
});
